#include "fxcc/imgui/Editor.h"
#include "fxcc/core/Dir.h"
#include "fxcc/core/graph/common/AnimationControllerMap.h"
#include "fxcc/core/graph/common/ActorLoader.h"

using namespace fxcc::graph::common;
using namespace fxcc::imgui;

template<>
bool Editor::Edit<AnimationControllerMap>(const std::string& l, AnimationControllerMap& e)
{
	bool flag{ 0 };
	bool combo = ImGui::BeginCombo(l.c_str(), e.m_Path.c_str());

	if (combo)
	{
		for (const auto& [key, value] : ActorLoader::m_Actors)
		{

			ImGui::PushID(&value);
			const std::string& itemLabel = key;
			bool selectable = ImGui::Selectable(itemLabel.c_str(), e.m_Path == key);
			if (selectable && e.m_Path!= key)
			{
				e.m_Path= key;
				e.m_Inst = value;
				flag = true;
			}
			ImGui::PopID();

		}

		ImGui::EndCombo();
	}

	return flag;

}

